<?php
$price_from = array(50000, 300000, 1000000, 3000000, 5000000, 8000000, 11000000);
$price_to = array(50000, 300000, 1000000, 3000000, 5000000, 8000000, 11000000, 100000000);
?>

<div id="search_block_top">
    <h3>Tìm kiếm sản phẩm:</h3>
    <?= form_open('product/search', array('method' => 'get')); ?>
    <input type="text" name="txtsearch" id="txtsearch" class="textbox" value="<?= isset($keyword) ? $keyword : "Tên sản phẩm" ?>" onclick="if(this.value=='Tên sản phẩm'){this.value='';}">
    <select name="selcategory" class="selBox">
        <option value="all-category">-- Tất cả danh mục --</option>
        <option class="opt-head"  value="san-pham">Điện thoại - Tablet</option>
        <?php foreach ($categories as $row): ?>
            <option value="sp-<?= $row->category_id ?>-<?= $row->category_name ?>">&nbsp;&nbsp;&nbsp; <?= $row->category_name ?></option>
        <?php endforeach; ?>
        <option class="opt-head" value="linh-kien">Linh Kiện</option>

        <?php foreach ($accessory_categories as $row): ?>
            <option value="lk-<?= $row->category_id ?>-<?= $row->category_name ?>"> &nbsp;&nbsp;&nbsp; <?= $row->category_name ?></option>
        <?php endforeach; ?>


    </select>
    <select name="selPriceFrom" class="selBox">
        <option value="price-from">-- Giá từ --</option>
        <?php foreach ($price_from as $price):
            ?>
        <option value="<?= $price ?>">
                <?= number_format($price) ?> đ
            </option>
        <?php endforeach; ?>
    </select>
    <select name="selPriceTo" class="selBox">
        <option value="price-to">-- Giá đến --</option>
        <?php foreach ($price_to as $price):
            ?>
            <option value="<?= $price ?>" >
                <?= $price == 100000000 ? "&gt;11,000,000" : number_format($price) ?> đ
            </option>


        <?php endforeach; ?>

    </select>
    <input type="submit" class="button" value="Tìm"/>
</form>
</div>